﻿using Clover.BaseAuth;
using Clover.Demo.App_Start;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Clover.Demo.Providers
{
    public class UserPermissionProvider : IPermissionProvider
    {
        public IEnumerable<Enum> GetPermissions()
        {
            yield return PermissionConfig.View;
        }

        public IEnumerable<Enum> GetPermissions(ControllerContext controllerContext, ActionDescriptor actionDescriptor )
        {
            if (DefaultCurrentIdentity.Default.GetIdentity() == "admin") {
                yield return PermissionConfig.Admin;
            }

            if (DefaultCurrentIdentity.Default.GetIdentity() == "user")
            {
                yield return PermissionConfig.User;
            }

        }
    }
}